from django import forms
from repository import models

# 添加文章
class ArticleForm(forms.ModelForm):

    class Meta:
        model = models.Article
        fields = '__all__'

    def __init__(self,*args,**kwargs):
        super(ArticleForm,self).__init__(*args,**kwargs)
        for field in self.fields.values():
            field.widget.attrs['class'] = 'form-control'

# 文章详情
class ArticleDetailForm(forms.ModelForm):

    class Meta:
        model = models.ArticleDetail
        fields = '__all__'